package ca.utoronto.utm.csc301.euchre.player;

import java.lang.reflect.InvocationTargetException;

import ca.utoronto.utm.csc301.euchre.gamemanager.GameManager;

public class PlayerFactory {
	
	/**
	 * Creates a player instance for the game managers. 
	 * 
	 * @param className
	 * @param id
	 * @param manager
	 * @return
	 * 
	 * @throws ClassNotFoundException
	 * @throws InstantiationException
	 * @throws IllegalAccessException
	 * @throws IllegalArgumentException
	 * @throws SecurityException
	 * @throws InvocationTargetException
	 * @throws NoSuchMethodException
	 */
	public static Player createPlayer(String className, int id, GameManager manager) 
							throws 	ClassNotFoundException, 
									InstantiationException, 
									IllegalAccessException, 
									IllegalArgumentException, 
									SecurityException, 
									InvocationTargetException, 
									NoSuchMethodException {
		return (Player) Class.forName(className).getConstructor(int.class, GameManager.class).newInstance(id, manager);
	}
}
